<!DOCTYPE html>
<html>
<head>
    <meta title="" charset="utf-8" content="text/html" http-equiv="content-type">
    <title></title>
<script type="text/javascript">
    function displayTime() {
        var elt = document.getElementById('clock');
        var now = new Date();
        elt.innerHTML = now.toLocaleTimeString();
        setTimeout(displayTime, 1000);
    }

    window.onload = displayTime;

    function modal() {
        window.showModalDialog('test.html',
        ['Enter 3D Properties', 'x','y','z'], 'dailogwidthL400; dialogheight:300; resizable:no');
    }

    var point = new Object();

    point = { x:0, y:10 }
    var point1 = { x:point.x, y:point.y }
    var value=0;
    var book = {
        name: '한글',
        date: 1900,
        edithin: 6,
        data_prop: value,
        get accessor_prop() { return this.data_prop;},
        set accessor_prop(value){ this.data_prop = value; },
        author : {
            firstname: '상욱',
            'lastname': 'lee'
        }
    }


    window.onload = check;

    var validation ={
        userId: 'leesanguck',
        pass: 'javaworld'
    }

    window.onload = validation;

    function check() {
        validation.userId = document.getElementById('userId').value;
        validation.pass = document.getElementById('pass').value;

        console.dir(validation.userId + " : " + validation.pass);
    }

    var title = book['date'];
    book['maintitle'] = 'ECMAscript';

    var o = {} // o는 Object.prototype을 상속받는 객체이고,
    o.x = 1; //고유 프로퍼티 x를 갖는다.

/*    console.dir('toString' in book);
    console.info(book.hasOwnProperty('date'));
    console.info(book.propertyIsEnumerable('date'));
    console.info(book.propertyIsEnumerable('toString'));
    console.error(book.date !== undefined);*/



    for(test in book)       //객체 book 의 모든 프로퍼티에 대해
        console.log(test);  //프로퍼티 이름을 출력한다

/*    for(prop in book){
        if(book.hasOwnProperty[prop]) continue;
        o[prop] = book[prop];
    }*/
/*    for(tt in o) console.log(tt);*/

    if(typeof o !== 'object') throw TypeError();
    var result = [];
    for(var prop in o)              //객체 o의 열거 가능한 프로퍼티들 중에
        if(prop in o)               //고유 프로퍼티인 경우에
            result.push(prop);      //배열에 프로퍼티 이름을 추가한다.

    for(xx in o) result.push(xx);

    var main = new Array();
    sub = new Array();

    sub['key1'] = 'hi';
    sub['key2'] = 'heeoo';
    sub['key3'] = 'student';
    main[0] = sub;

    var sub = new Array();
    sub['key1'] = 'tt';
    sub['key2'] = 'sanguck';
    sub['key3'] = '5';
    main[1] = sub;

    var sub = new Array();
    sub['key1'] = 'leesanguck';
    sub['key2'] = '용인';
    sub['key3'] = '경기도';

    main[2] = sub;

    var jsonObject = {list:main};

    for(var i =0; i < jsonObject.list.length; i++){
        var obj = jsonObject.list[i];
        console.log(obj.key1+ "      <------------>       "+ obj.key2+ "    <-------->    " + obj.key3);
    }
</script>
<style type="text/css">
#clock {
    font: bold 24pt sans;
    background: #ddf;
    padding: 10px;
    border: 2px solid #000000;
    border-radius: 10px;
}


</style>
</head>
<body>
<span id="clock"></span>
<div>
    <form>
        <label>아이디 :</label><input type="text" name="userId" id="userId">
        <label>아이디 :</label><input type="password" name="pass" id="pass">
        <button type="submit" onclick="javascript:check();">버튼</button>
        <button type="submit" onclick="javascript:modal();">버튼</button>
    </form>
</div>
</body>
</html>